//
//  QXHomeTopicCell.swift
//  DanTangSwift
//
//  Created by 众力金融 on 2017/6/20.
//  Copyright © 2017年 ..... All rights reserved.
//

import UIKit
import Kingfisher

class QXHomeTopicCell: UITableViewCell {
  
    
    @IBOutlet weak var favoriteBtn: UIButton!
    
    @IBOutlet weak var bacgroudImageView: UIImageView!
    
    @IBOutlet weak var titleLabel: UILabel!
    
    var model : QXHomeTopicModel? {
        didSet {
            
            let url = URL(string: model!.cover_image_url!)
            let image = #imageLiteral(resourceName: "PlaceHolderImage_small_31x26_")
            bacgroudImageView.kf.setImage(with: url, placeholder: image, options: nil, progressBlock: nil, completionHandler: nil)
            titleLabel.text = model?.title
            favoriteBtn.setTitle("" + String(describing: model!.likes_count!) + "", for: .normal)
        }
    }
    
    
    override func awakeFromNib() {
        super.awakeFromNib()
        
        bacgroudImageView.layer.cornerRadius = 5.0
        bacgroudImageView.layer.masksToBounds = true
        bacgroudImageView.layer.shouldRasterize = true
        bacgroudImageView.layer.rasterizationScale = UIScreen.main.scale
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }
    
    
}
